<template>
  <div class="step" v-if="stepList.length > 0">
    <div class="step-item" v-for="(item, index) in stepList" :key="index">
      <div
        class="step-content"
        :class="{ active: active === index + 1, inactive: active < index + 1}"
      >
        <div class="step-circle">
          <span>{{ index + 1 }}</span>
        </div>
        <p class="title">{{ item.name ||  item.label }}</p>
        <p class="desc" v-show="item.desc">{{ item.desc }}</p>
      </div>
      <img
        class="step-line"
        v-if="index !== props.stepList.length - 1"
        src="/src/assets/images/icons/icon-step-arrow@2x.png"
      />
    </div>
  </div>
</template>
<script setup>
const props = defineProps({
  stepList: {
    type: Array,
    default: () => [],
  },
  active: {
    type: Number,
    default: 1,
  },
});
</script>
<style scoped lang="scss">
.step {
  display: flex;
  .step-item {
    display: flex;
    .step-content {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      .step-circle {
        margin: 0 10px;
        width: 30px;
        height: 30px;
        opacity: 1;
        border: 3px solid #5255fe;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        span {
          color: #5255fe;
          font-size: 16px;
          font-weight: 400;
        }
      }
      .desc {
        color: #a6a6a6;
        font-size: 14px;
      }
      .title {
        padding-top: 10px;
        padding-bottom: 8px;
        color: #383838;
        font-size: 14px;
      }
      &.active {
        .step-circle {
          color: #ff8d1a;
          border: 3px solid #ff8d1a;
        }
        span,
        .title,
        .desc {
          color: #ff8d1a;
        }
      }
      &.inactive {
        .step-circle {
          color: #A6A6A6;
          border: 3px solid #A6A6A6;
        }
        span,
        .title,
        .desc {
          color: #A6A6A6;
        }
      }
    }

    .step-line {
      width: 104px;
      height: 8px;
      padding-top: 14px;
    }

    .active {
      color: #ff8d1a;
    }
    .inactive {
      color: #A6A6A6;
    }
  }
}
</style>